﻿/*************************************************************************
* @File			:	AppMain.cs
* @Description	:
*
*
*
*
************************************************************************/
using UnityEngine;
using System.Collections.Generic;
using FairyGUI;

namespace Framework
{
    class AppMain : MonoBehaviour
    {

        // lua 管理
        private LuaManager luaManager;

        // --------------------------------------------------------------------------------
        // 唤醒
        private void Awake()
        {
            // 初始化Lua管理
            luaManager = LuaManager.Instance;
            luaManager.Init();

            luaManager.DoString("require('main')");

            DontDestroyOnLoad(this.gameObject);
        }
        // --------------------------------------------------------------------------------
        // 开始
        private void Start()
        {

        }
        // --------------------------------------------------------------------------------
        // 物理更新
        private void FixedUpdate()
        {
            
        }
        // --------------------------------------------------------------------------------
        // 逻辑更新
        private void Update()
        {

            luaManager.NewUpdate();
        }
        // --------------------------------------------------------------------------------
        // 逻辑更新之后更新
        private void LateUpdate()
        {
            
        }
        // --------------------------------------------------------------------------------
        // 应用退出
        private void OnApplicationQuit()
        {
        }
        // --------------------------------------------------------------------------------
        // 应用聚焦
        private void OnApplicationFocus(bool hasFocus)
        {
        }
        // --------------------------------------------------------------------------------
        // 应用暂停
        private void OnApplicationPause(bool paused)
        {
        }
        // --------------------------------------------------------------------------------
        // 销毁
        private void OnDestroy()
        {

            luaManager.Destroy();



            luaManager = null;
        }
    }
}
